package cn.kgm.makeGod;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * @Version 1.8
 * @Author: Kappi
 * @Date: 2025-9-11 16:32
 * @Description: cn.kgm.makeGod.MapUtils
 */
public class MapUtils {
    @SafeVarargs
    public static <K, V> Map<K, V> mapOf(Pair<K, V>... pairs) {
        Map<K, V> map = new HashMap<>();
        for (Pair<K, V> pair : pairs) {
            map.put(pair.key, pair.value);
        }
        return Collections.unmodifiableMap(map);
    }

    public static <K, V> Pair<K, V> pair(K key, V value) {
        return new Pair<>(key, value);
    }

    public static class Pair<K, V> {
        public final K key;
        public final V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }
    }
}
